<template>
  <c-permission-tabs v-model="activeTab" type="card" code="tab">
    <el-tab-pane label="零售商客户" name="retail_customer" lazy>
      <RetailCustomer ref="retail_customer" :tab-index="1" />
    </el-tab-pane>
    <el-tab-pane label="轻居客户" name="light_customer" lazy>
      <LightCustomer ref="light_customer" table-name="light_customer" :tab-index="2" />
    </el-tab-pane>
  </c-permission-tabs>
</template>

<script>
import RetailCustomer from './components/retailCustomer'
import LightCustomer from './components/lightCustomer'
export default {
  name: 'Customer',
  components: {
    RetailCustomer,
    LightCustomer
  },
  props: {
  },
  data() {
    return {
      activeTab: 'retail_customer'
    }
  },
  computed: {
  },
  watch: {
    activeTab(v) {
      if (this.$refs[v]) {
        this.$nextTick(() => {
          this.refreshTableBoxData('onPage')
        })
      }
    }
  },
  mounted() {
  },
  methods: {
    refreshTableBoxData(flag) {
      const activeTab = this.activeTab
      this.$nextTick(() => {
        this.$refs[activeTab] && this.$refs[activeTab].refreshTableBoxData(flag)
      })
    }
  }
}
</script>
